package com.ocom.common.request.exposeapi;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @Description: TODO
 * @Author: 朱晖
 * @Date: 2023/3/23
 **/
@Data
public class CardOperationRequest {

	/**
	 * pCode	学工号	string		是
	 * type	操作类型	int	1-发卡，2-退卡，3-挂失，4-解挂	是
	 * cardNo	卡号	String		是
	 */

	@JsonProperty("pCode")
	@NotBlank(message = "pCode 不能为空")
	String pCode;

	@Max(value = 4, message = "type最大4")
	@Min(value = 1, message = "type最小1")
	@NotNull(message = "type 不能为空")
	Integer type;

	@JsonProperty("cardNo")
	@NotBlank(message = "cardNo 不能为空")
	String cardNo;

	@NotNull(message = "timestamp 毫秒时间长不能为空")
	Long timestamp;


	@NotBlank(message = "comId 不能为空")
	String comId;   //实际是 comAppId
	@NotBlank(message = "nonceStr 不能为空")
	@Length(min = 32, max = 32, message = "nonceStr长度必须为32")
	String nonceStr;  // 32
	@Length(min = 32, max = 32, message = "sign长度必须为32")
	@NotBlank(message = "sign 不能为空")
	String sign;   //实际是 comAppId

	@Override
	public String toString() {
		return "CardOperationRequest{" +
				"pCode='" + pCode + '\'' +
				", type=" + type +
				", cardNo='" + cardNo + '\'' +
				", timestamp=" + timestamp +
				", comId='" + comId + '\'' +
				", nonceStr='" + nonceStr + '\'' +
				", sign='" + sign + '\'' +
				'}';
	}
}
